package com.java.dao.Impl;

import com.java.dao.queryFlightNo;
import com.java.entity.AirLine;
import com.java.entity.FlightInformation;
import com.java.util.C3P0Util;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * 通过航线号查询航班
 */
public class queryFlightNoImpl implements queryFlightNo {
    QueryRunner qr=new QueryRunner(C3P0Util.getDataSource());
    @Override
    public List<FlightInformation> queryFlight(String airlineNo) throws SQLException {
        String sql="select * from f_flightInformation where airlineNo=?";

        List<FlightInformation> FlightList=new ArrayList<>();
        FlightList=qr.query(sql,new BeanListHandler<FlightInformation>(FlightInformation.class),airlineNo);
        return FlightList;



    }
}
